package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.SalaryList;
import cn.wolfcode.crm.mapper.SalaryListMapper;
import cn.wolfcode.crm.query.SalaryListQueryObject;
import cn.wolfcode.crm.service.ISalaryListService;
import cn.wolfcode.crm.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class SalaryListServiceImpl implements ISalaryListService {
    @Autowired
    private SalaryListMapper salaryListMapper;

    public void changState(Long id) {
        salaryListMapper.changState(id);
    }

    public PageResult query(SalaryListQueryObject qo) {
        int total = salaryListMapper.query4Count(qo);
        if(total > 0){
            return new PageResult(total,salaryListMapper.query4List(qo));
        }
        return new PageResult(total, Collections.EMPTY_LIST);
    }

    public int deleteByPrimaryKey(Long id)
    {
        return salaryListMapper.deleteByPrimaryKey(id);
    }

    public int insert(SalaryList record) {

        return salaryListMapper.insert(record);
    }

    public SalaryList selectByPrimaryKey(Long id) {

        return salaryListMapper.selectByPrimaryKey(id);
    }

    public List<SalaryList> selectAll() {

        return salaryListMapper.selectAll();
    }

    public int updateByPrimaryKey(SalaryList record)
    {
        return salaryListMapper.updateByPrimaryKey(record);
    }
}
